package org.xfy.org.domain;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
//Serializable开启序列化
@Data
public class Department implements Serializable {
    //部门ID
    @ApiModelProperty(value ="部门ID" )
    private Long id;
    //部门编号
    @NotBlank(message = "部门编号不能为空")
    @ApiModelProperty(value ="部门编号" )
    private String sn;
    //部门名称
    @ApiModelProperty(value ="部门名称" )
    @NotBlank(message = "部门名称不能为空")
    private String name;
    //部门路径
    @ApiModelProperty(value ="部门路径" )
    private String dirPath;
    //部门状态：1启用,0禁用
    @ApiModelProperty(value ="部门状态1启用,0禁用" )
    private Integer state = 1;
    //部门经理ID
    private Long managerId;
    //上级部门ID
    private Long parentId;

    private String username;
    private String tname;
    //用于封装当前部门的子部门
    //部门树最后一级没有数据就不显示
    //坑：children这个单词不能乱写，必须与elementUI的上传组件中保持一致，不然前端没有数据
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<Department> children =new ArrayList<Department>();
}